*===============================================================================
* Project title		Savings Accounts to Borrow Less	
* PIs			Felipe Kast, Dina Pomeranz 
* File name		5c_hetero_lending.do
*-------------------------------------------------------------------------------
* Description		Creates lending heterogeneity table 
* Outputs		Table A24 
* Spaces per tab 	8 
*===============================================================================

*===============================================================================
*TOC
*1)	Prepare data for analysis
*2)	Tables
*2.1)	Calculates table content 
*2.2)	Writes table
*===============================================================================

*===============================================================================
* Section 1 - Prepare data for analysis
*===============================================================================

clear all
global path "~/file_server/project_savings/2_shared/impact/do/November2019"	// Path to processed data
global results "$path/results"		
cd "$results"									// Change to directory to store results
set more off
set trace off
*Loading processed data
	use $path/datasets/impactDatabase.dta, clear

*===============================================================================
* Section 2 - Tables 
*===============================================================================
* Section 2.1 - Calculates table content 
*-------------------------------------------------------------------------------

	eststo clear
	
// Calculates content for Panels C-F	
	local i = 12
	
	foreach y in w5_totalLending /*A7 A8 A9*/ w1_totalLending /*A10 A11 A12*/ ///
	totalLending /*A13 A14 A15*/ IHStotalLending /*A16 A17 A18*/ {
	
	local i = `i' + 1 //updates counter
	local j = 1 //tracks column number 
	
	reg d.`y' // mark subjects nonmissing in both periods
	egen t1 = max(e(sample)), by(idBaseSurvey)
		
		*Col 1 regression. 			
			reghdfe `y' c.accountAccess#c.post post if t1 == 1,	 ///
			abs(idBaseSurvey) vce(cluster groupId)
			
			gen `y'_s`j' = e(sample) //marks observations used in sample for regression
			
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post =      "No"
			estadd local hasacc_post =      "No"
                        estadd local soctaxed_post =    "No"
                        estadd local conflict_post =    "No"
                        estadd local ecoshock_post =    "No"
			eststo A`i'
		
		local i = `i' + 1 //updates counter
		local j = `j' + 1 //updates col number
			
		*Col 2 regression. 
			reghdfe `y' c.accountAccess#c.post#c.regretsNotSaving	///
			c.post#c.regretsNotSaving c.accountAccess#c.post post 	///
			if t1 == 1, abs(idBaseSurvey)				/// 
			vce(cluster groupId) 
			
			gen `y'_s`j' = e(sample) //marks observations used in sample for regression
					
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"Yes"
			estadd local hasacc_post = 	"No"
			estadd local soctaxed_post = 	"No"
                        estadd local conflict_post = 	"No"
                        estadd local ecoshock_post =    "No"
			eststo A`i'
		
		local i = `i' + 1 //updates counter
		local j = `j' + 1 //updates col number 

		*Col 3 regression. 
			reghdfe `y' c.accountAccess#c.post#c.hasPrevAccount	///
			c.post#c.hasPrevAccount c.accountAccess#c.post post 	///
			if t1 == 1, abs(idBaseSurvey) 				///
			vce(cluster groupId) 
			
			gen `y'_s`j' = e(sample) //marks observations used in sample for regression
					
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"No"
			estadd local hasacc_post = 	"Yes"
			estadd local soctaxed_post =    "No"
                        estadd local conflict_post =    "No"
                        estadd local ecoshock_post =    "No"
			eststo A`i'
			
		local i = `i' + 1 //updates counter
		local j = `j' + 1 //updates col number
			
                *Col 4 regression. 
			reghdfe `y' c.accountAccess#c.post#c.sociallyTaxed	///
			c.post#c.sociallyTaxed c.accountAccess#c.post post 	///
			if t1 == 1, abs(idBaseSurvey) 				///
			vce(cluster groupId) 
			
			gen `y'_s`j' = e(sample) //marks observations used in sample for regression
					
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"No"
			estadd local hasacc_post = 	"No"
			estadd local soctaxed_post =    "Yes"
                        estadd local conflict_post =    "No"
                        estadd local ecoshock_post =    "No"
			eststo A`i'
			
		local i = `i' + 1 //updates counter
		local j = `j' + 1 //updates col number

                 *Col 5 regression. 
			reghdfe `y' c.accountAccess#c.post#c.conflictsMoney	///
			c.post#c.conflictsMoney c.accountAccess#c.post post 	///
			if t1 == 1, abs(idBaseSurvey) 				///
			vce(cluster groupId) 
			
			gen `y'_s`j' = e(sample) //marks observations used in sample for regression
					
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"No"
			estadd local hasacc_post = 	"No"
			estadd local soctaxed_post =    "No"
                        estadd local conflict_post =    "Yes"
                        estadd local ecoshock_post =    "No"
			eststo A`i'
			
		local i = `i' + 1 //updates counter
		local j = `j' + 1 //updates col number

                *Col 6 regression. 
			reghdfe `y' c.accountAccess#c.post#c.economicShock2009	///
			c.post#c.economicShock2009 c.accountAccess#c.post post 	///
			if t1 == 1, abs(idBaseSurvey) 				///
			vce(cluster groupId) 
			
			gen `y'_s`j' = e(sample) //marks observations used in sample for regression
					
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"No"
			estadd local hasacc_post = 	"No"
			estadd local soctaxed_post =    "No"
                        estadd local conflict_post =    "No"
                        estadd local ecoshock_post =    "Yes"
			eststo A`i'


		drop t1	
		di in red "`i'"
	}

// Variables to add as condition in regression for panels A and B 
	foreach x in 1 2 3 4 5 6 {
	gen in_s`x' = 1 if w5_totalLending_s`x' == 1 & w1_totalLending_s`x' == 1 	///
	& totalLending_s`x' == 1 & IHStotalLending_s`x' == 1
	}
	
	
// Calculates content for Panels A and B	
	local i = 0
	
	foreach y in prLendingTot /*A1-6*/ totalLendingIndex /*A7-12*/ ///
	{
	
	local i = `i' + 1 //updates counter
	local j = 1 //tracks column number 
	
	reg d.`y' // mark subjects nonmissing in both periods
	egen t1 = max(e(sample)), by(idBaseSurvey)
		
		*Col 1 regression. 			
			reghdfe `y' c.accountAccess#c.post post if t1 == 1 & in_s`j' == 1,	 ///
			abs(idBaseSurvey) vce(cluster groupId)
			
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post =      "No"
			estadd local hasacc_post =      "No"
                        estadd local soctaxed_post =    "No"
                        estadd local conflict_post =    "No"
                        estadd local ecoshock_post =    "No"
			eststo A`i'
		
		local i = `i' + 1 //updates counter
		local j = `j' + 1 //updates col number
			
		*Col 2 regression. 
			reghdfe `y' c.accountAccess#c.post#c.regretsNotSaving	///
			c.post#c.regretsNotSaving c.accountAccess#c.post post 	///
			if t1 == 1 & in_s`j' == 1, abs(idBaseSurvey)	/// 
			vce(cluster groupId) 
					
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"Yes"
			estadd local hasacc_post = 	"No"
			estadd local soctaxed_post = 	"No"
                        estadd local conflict_post = 	"No"
                        estadd local ecoshock_post =    "No"
			eststo A`i'
		
		local i = `i' + 1 //updates counter
		local j = `j' + 1 //updates col number 

		*Col 3 regression. 
			reghdfe `y' c.accountAccess#c.post#c.hasPrevAccount	///
			c.post#c.hasPrevAccount c.accountAccess#c.post post 	///
			if t1 == 1 & in_s`j' == 1, abs(idBaseSurvey) 		///
			vce(cluster groupId) 
					
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"No"
			estadd local hasacc_post = 	"Yes"
			estadd local soctaxed_post =    "No"
                        estadd local conflict_post =    "No"
                        estadd local ecoshock_post =    "No"
			eststo A`i'
			
		local i = `i' + 1 //updates counter
		local j = `j' + 1 //updates col number
			
                *Col 4 regression. 
			reghdfe `y' c.accountAccess#c.post#c.sociallyTaxed	///
			c.post#c.sociallyTaxed c.accountAccess#c.post post 	///
			if t1 == 1 & in_s`j' == 1, abs(idBaseSurvey) 	///
			vce(cluster groupId) 
					
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"No"
			estadd local hasacc_post = 	"No"
			estadd local soctaxed_post =    "Yes"
                        estadd local conflict_post =    "No"
                        estadd local ecoshock_post =    "No"
			eststo A`i'
			
		local i = `i' + 1 //updates counter
		local j = `j' + 1 //updates col number

                 *Col 5 regression. 
			reghdfe `y' c.accountAccess#c.post#c.conflictsMoney	///
			c.post#c.conflictsMoney c.accountAccess#c.post post 	///
			if t1 == 1 & in_s`j' == 1, abs(idBaseSurvey) 	///
			vce(cluster groupId) 
					
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"No"
			estadd local hasacc_post = 	"No"
			estadd local soctaxed_post =    "No"
                        estadd local conflict_post =    "Yes"
                        estadd local ecoshock_post =    "No"
			eststo A`i'
			
		local i = `i' + 1 //updates counter
		local j = `j' + 1 //updates col number

                *Col 6 regression. 
			reghdfe `y' c.accountAccess#c.post#c.economicShock2009	///
			c.post#c.economicShock2009 c.accountAccess#c.post post 	///
			if t1 == 1 & in_s`j' == 1, abs(idBaseSurvey) 	///
			vce(cluster groupId) 
					
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"No"
			estadd local hasacc_post = 	"No"
			estadd local soctaxed_post =    "No"
                        estadd local conflict_post =    "No"
                        estadd local ecoshock_post =    "Yes"
			eststo A`i'


		drop t1	
		di in red "`i'"
	}
	
//Col 7 8 9 regressions below:
// Panels C-F

	local i = 6
	
	foreach y in w5_totalLending w5_familyLending w5_businessLending 		/*B7 B8 B9*/		///
			w1_totalLending w1_familyLending w1_businessLending		/*B10 B11 B12*/ 	///
			totalLending familyLending businessLending			/*B13 B14 B15*/ 	///
			IHStotalLending IHSfamilyLending IHSbusinessLending 		/*B16 B17 B18*/  {
				
			local i = `i' + 1
			reg d.`y' //trick to mark subjects nonmissing in both periods
			egen t1 = max(e(sample)), by(idBaseSurvey)		
			
			reghdfe `y' c.accountAccess#c.post#c.hasPrevAccount 	///
			c.accountAccess#c.post#c.regretsNotSaving 		///
			c.accountAccess#c.post#c.sociallyTaxed 			///
			c.accountAccess#c.post#c.conflictsMoney 		///
			c.accountAccess#c.post#c.economicShock2009 		///
			c.post#c.hasPrevAccount c.post#c.regretsNotSaving 	///
			c.post#c.sociallyTaxed c.post#c.conflictsMoney 		///
			c.post#c.economicShock2009  				///
			c.accountAccess#c.post post if t1 == 1, abs(idBaseSurvey) ///
			vce(cluster groupId) 
			
			gen `y'_s = e(sample) //marks observations used in the regression 

			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"Yes"
			estadd local hasacc_post = 	"Yes"
			estadd local soctaxed_post =    "Yes"
                        estadd local conflict_post =    "Yes"
                        estadd local ecoshock_post =    "Yes"
			eststo B`i'
			
		drop t1
		di in red "`i'"

	}
	
// Variables to add as condition in regression for panels A and B 
	
	gen prLendingTot_s = w5_totalLending_s
	gen totalLendingIndex_s = w1_totalLending_s
	gen prLendingfamily_s = w5_familyLending_s
	gen familyLendingIndex_s = w1_familyLending_s
	gen prLendingbusiness_s = w5_businessLending_s
	gen businessLendingIndex_s = w1_businessLending_s
	
// Panel A & B 
	local i = 0
	
	foreach y in prLendingTot prLendingfamily prLendingbusiness 		/*B1 B2 B3*/ 	///
		totalLendingIndex familyLendingIndex businessLendingIndex	/*B4 B5 B6*/ {
				
			local i = `i' + 1
			reg d.`y' //trick to mark subjects nonmissing in both periods
			egen t1 = max(e(sample)), by(idBaseSurvey)		
			
			reghdfe `y' c.accountAccess#c.post#c.hasPrevAccount 	///
			c.accountAccess#c.post#c.regretsNotSaving 		///
			c.accountAccess#c.post#c.sociallyTaxed 			///
			c.accountAccess#c.post#c.conflictsMoney 		///
			c.accountAccess#c.post#c.economicShock2009 		///
			c.post#c.hasPrevAccount c.post#c.regretsNotSaving 	///
			c.post#c.sociallyTaxed c.post#c.conflictsMoney 		///
			c.post#c.economicShock2009  				///
			c.accountAccess#c.post post if t1 == 1 & `y'_s == 1, 	///
			abs(idBaseSurvey) ///
			vce(cluster groupId) 
			
		 

			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"Yes"
			estadd local hasacc_post = 	"Yes"
			estadd local soctaxed_post =    "Yes"
                        estadd local conflict_post =    "Yes"
                        estadd local ecoshock_post =    "Yes"
			eststo B`i'
			
		drop t1
		di in red "`i'"

	}
                
*-------------------------------------------------------------------------------
* Section 2.2 - Writes table 
*-------------------------------------------------------------------------------

//probability	
	esttab A1 A2 A3 A4 A5 A6 B1 B2 B3 using tab_het_lend.tex, replace		///
	cells(b(star fmt(%12.3fc)) se(par fmt(%12.3fc))) label style(tex) nonumber	///
	stats( control_mean, fmt(%12.3fc %12.0fc %12.0fc)				///
	label("Control mean")) mlabels(,none) 						///	
	collabels(, none) eqlabels(, none)  						///
	keep(c.accountAccess#c.post#c.regretsNotSaving 					///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	order(c.accountAccess#c.post#c.regretsNotSaving 				///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	varlabels(c.accountAccess#c.post#c.regretsNotSaving 				///
		"Account $\times$ post $\times$ regret not saving more"         	///
		c.accountAccess#c.post#c.hasPrevAccount 				/// 
		"Account $\times$ post $\times$ already has bank account"	        ///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		"Account $\times$ post $\times$ socially taxed"		                ///
		c.accountAccess#c.post#c.conflictsMoney 				///
		"Account $\times$ post $\times$ household conflicts"			///
		c.accountAccess#c.post#c.economicShock2009 				///
		"Account $\times$ post $\times$ economic shock"                 	///	
		c.accountAccess#c.post "Account $\times$ post")				///
	starlevels(* 0.1 ** 0.05 *** 0.01) 						///
	prehead(\begin{tabular}{l*{@M}{c}} \hline \hline) 				 ///	
	posthead(	& (1) 		& (2) 		& (3) 		& (4) 		& (5) 		& (6) 		& (7) 		& (8) 		& (9) \\ 	///
			&  Total 	& Total 	& Total 	& Total 	&  Total 	&  Total 	&  Total 	& Lent to 	& Lent to \\ 	///
			&  lending 	& lending 	& lending 	& lending 	&  lending 	&  lending 	&  lending 	& family and 	& business \\	///
			& 		& 		& 		& 		& 		& 		& 		& friends 	& contacts \\ 	///
		\hline \\ \multicolumn{@span}{l}{\textbf{Panel A:} Probability of Any Lending} \\) 		///
	prefoot( ) 												/// 
	postfoot( )

//categories
	esttab A7 A8 A9 A10 A11 A12 B4 B5 B6 using tab_het_lend.tex, append		///
	cells(b(star fmt(%12.3fc)) se(par fmt(%12.3fc))) label style(tex) nonumber	///
	stats( control_mean, fmt(%12.3fc %12.0fc %12.0fc)				///
	label("Control mean")) mlabels(,none) 						///	
	collabels(, none) eqlabels(, none)  						///
	keep(c.accountAccess#c.post#c.regretsNotSaving 					///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	order(c.accountAccess#c.post#c.regretsNotSaving 				///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	varlabels(c.accountAccess#c.post#c.regretsNotSaving 				///
		"Account $\times$ post $\times$ regret not saving more"         	///
		c.accountAccess#c.post#c.hasPrevAccount 				/// 
		"Account $\times$ post $\times$ already has bank account"	        ///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		"Account $\times$ post $\times$ socially taxed"		                ///
		c.accountAccess#c.post#c.conflictsMoney 				///
		"Account $\times$ post $\times$ household conflicts"			///
		c.accountAccess#c.post#c.economicShock2009 				///
		"Account $\times$ post $\times$ economic shock"                 	///	
		c.accountAccess#c.post "Account $\times$ post")				///
	starlevels(* 0.1 ** 0.05 *** 0.01) 						///
	prehead( )									///
	posthead(\\ \multicolumn{@span}{l}{\textbf{Panel B:} Categories of Lending} \\ ) ///
	prefoot( ) postfoot( )
	
//winsor 5%
	esttab A13 A14 A15 A16 A17 A18 B7 B8 B9 using tab_het_lend.tex, append		///
	cells(b(star fmt(%12.0fc)) se(par fmt(%12.0fc))) label style(tex) nonumber	///
	stats( control_mean, fmt(%12.3fc %12.0fc %12.0fc)				///
	label("Control mean")) mlabels(,none) 						///	
	collabels(, none) eqlabels(, none)  						///
	keep(c.accountAccess#c.post#c.regretsNotSaving 					///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	order(c.accountAccess#c.post#c.regretsNotSaving 				///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	varlabels(c.accountAccess#c.post#c.regretsNotSaving 				///
		"Account $\times$ post $\times$ regret not saving more"         	///
		c.accountAccess#c.post#c.hasPrevAccount 				/// 
		"Account $\times$ post $\times$ already has bank account"	        ///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		"Account $\times$ post $\times$ socially taxed"		                ///
		c.accountAccess#c.post#c.conflictsMoney 				///
		"Account $\times$ post $\times$ household conflicts"			///
		c.accountAccess#c.post#c.economicShock2009 				///
		"Account $\times$ post $\times$ economic shock"                 	///	
		c.accountAccess#c.post "Account $\times$ post")				///
	starlevels(* 0.1 ** 0.05 *** 0.01) 						///
	prehead( )									///
	posthead(\\ \multicolumn{@span}{l}{\textbf{Panel C:}  Amounts (Winsorized at the Top 5\%)} \\ ) ///
        prefoot( ) 									///
	postfoot( )

//winsor 1%
	esttab A19 A20 A21 A22 A23 A24 B10 B11 B12 using tab_het_lend.tex, append	///
	cells(b(star fmt(%12.0fc)) se(par fmt(%12.0fc))) label style(tex) nonumber	///
	stats( control_mean, fmt(%12.3fc %12.0fc %12.0fc)			        ///
	label("Control mean")) mlabels(,none) 		                                ///	
	collabels(, none) eqlabels(, none)  						///
	keep(c.accountAccess#c.post#c.regretsNotSaving 					///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	order(c.accountAccess#c.post#c.regretsNotSaving 				///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	varlabels(c.accountAccess#c.post#c.regretsNotSaving 				///
		"Account $\times$ post $\times$ regret not saving more"         	///
		c.accountAccess#c.post#c.hasPrevAccount 				/// 
		"Account $\times$ post $\times$ already has bank account"	        ///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		"Account $\times$ post $\times$ socially taxed"		                ///
		c.accountAccess#c.post#c.conflictsMoney 				///
		"Account $\times$ post $\times$ household conflicts"			///
		c.accountAccess#c.post#c.economicShock2009 				///
		"Account $\times$ post $\times$ economic shock"                 	///	
		c.accountAccess#c.post "Account $\times$ post")				///
	starlevels(* 0.1 ** 0.05 *** 0.01) 						///
	prehead( ) 				 					///	
	posthead(\\ \multicolumn{@span}{l}{\textbf{Panel D:} Amounts (Winsorized at the Top 1\%)} \\ ) ///
	prefoot( ) 									///
	postfoot(\\ \hline \hline \end{tabular} )

	
// non-winsorized
	esttab A25 A26 A27 A28 A29 A30 B13 B14 B15 using tab_het_lend2.tex, replace	///
	cells(b(star fmt(%12.0fc)) se(par fmt(%12.0fc))) label style(tex) nonumber	///
	stats( control_mean, fmt(%12.3fc %12.0fc %12.0fc)				///
	label("Control mean")) mlabels(,none) 						///	
	collabels(, none) eqlabels(, none)  						///
	keep(c.accountAccess#c.post#c.regretsNotSaving 					///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	order(c.accountAccess#c.post#c.regretsNotSaving 				///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	varlabels(c.accountAccess#c.post#c.regretsNotSaving 				///
		"Account $\times$ post $\times$ regret not saving more"         	///
		c.accountAccess#c.post#c.hasPrevAccount 				/// 
		"Account $\times$ post $\times$ already has bank account"	        ///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		"Account $\times$ post $\times$ socially taxed"		                ///
		c.accountAccess#c.post#c.conflictsMoney 				///
		"Account $\times$ post $\times$ household conflicts"			///
		c.accountAccess#c.post#c.economicShock2009 				///
		"Account $\times$ post $\times$ economic shock"                 	///	
		c.accountAccess#c.post "Account $\times$ post")				///
	starlevels(* 0.1 ** 0.05 *** 0.01) 						///
	prehead(\begin{tabular}{l*{@M}{c}} \hline \hline )									///
	posthead(	& (1) 		& (2) 		& (3) 		& (4) 		& (5) 		& (6) 		& (7) 		& (8) 		& (9) \\ 	///
			&  Total 	& Total 	& Total 	& Total 	&  Total 	&  Total 	&  Total 	& Lent to 	& Lent to \\ 	///
			&  lending 	& lending 	& lending 	& lending 	&  lending 	&  lending 	&  lending 	& family and 	& business \\	///
			& 		& 		& 		& 		& 		& 		& 		& friends 	& contacts \\ 	/// 
		\hline \\ \multicolumn{@span}{l}{\textbf{Panel E:} Non-Winsorized Amounts} \\ ) ///
	prefoot( ) postfoot( )	
	
// IHS
	esttab A31 A32 A33 A34 A35 A36 B16 B17 B18 using tab_het_lend2.tex, append 	///
	cells(b(star fmt(%12.3fc)) se(par fmt(%12.3fc))) label style(tex) nonumber	///
	stats( control_mean num_ind N regret_post hasacc_post soctaxed_post conflict_post ///
	ecoshock_post ind_fixeff, fmt(%12.3fc %12.0fc %12.0fc)				///
	label("Control mean" "\\ \hline Individuals" "Observations" 			///
		"Post $\times$ regret not saving more" 					///
		"Post $\times$ already has bank account" 				///
		"Post $\times$ socially taxed"						///
		"Post $\times$ household conflicts"					///
		"Post $\times$ economic shock"						///
		"Individual FE" )) mlabels(,none) 					///	
	collabels(, none) eqlabels(, none)  						///
	keep(c.accountAccess#c.post#c.regretsNotSaving 					///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	order(c.accountAccess#c.post#c.regretsNotSaving 				///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	varlabels(c.accountAccess#c.post#c.regretsNotSaving 				///
		"Account $\times$ post $\times$ regret not saving more"         	///
		c.accountAccess#c.post#c.hasPrevAccount 				/// 
		"Account $\times$ post $\times$ already has bank account"	        ///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		"Account $\times$ post $\times$ socially taxed"		                ///
		c.accountAccess#c.post#c.conflictsMoney 				///
		"Account $\times$ post $\times$ household conflicts"			///
		c.accountAccess#c.post#c.economicShock2009 				///
		"Account $\times$ post $\times$ economic shock"                 	///	
		c.accountAccess#c.post "Account $\times$ post")				///
	prehead( ) ///
	posthead(\\ \multicolumn{@span}{l}{\textbf{Panel F:} Inverse Hyperbolic Sine of Amount} \\ ) ///
	prefoot( ) ///
	postfoot(\hline \hline \end{tabular} )	
	
	
